<?php include_once('header.php');?>
	<div class="main-content">
		<div class="breadcrumbs" id="breadcrumbs">
			<script type="text/javascript">
				try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
			</script>
			<ul class="breadcrumb">
				<li><a href="/admin/welcome"><i class="icon-home home-icon"></i>首页</a></li>
				<li><a href="#">报单币管理</a></li>
				<li>转报单币列表</li>
			</ul>
		</div>
		<div class="page-content" style="margin-top:18px;">	
			<div class="row">
				<div class="col-xs-12">
					<div style="border:1px solid #e1e1e1;">
						<div style="height:50px;"><span style="background-color:#f9f9f9;width:100px; height:40px; display:inline-block;*display:inline;*zoom; border:1px solid #e2e2e5; line-height:40px;color:#666; text-align:center;"><b>基本信息</b></span></div>				
						<form class="form-horizontal" enctype="multipart/form-data" role="form" method="post" action="/admin/system_money/add"  onsubmit="return check()">
							<div class="form-group">
								<label for="title" class="col-sm-1 control-label">姓名：</label>
								<div class="col-sm-2">
                                                                    <input type="text" readonly="true" class="form-control" id="true_name" name="true_name" value="<?php echo $true_name;?>">
                                                                    <input type="hidden" readonly="true" class="form-control" id="username" name="username" value="<?php echo $username;?>">
								</div>
							</div>
							<div class="form-group">
								<label for="title" class="col-sm-1 control-label">余额</label>
								<div class="col-sm-2">
                                                                    <input type="text" readonly="true" id="balance" class="form-control" value="<?php echo $balance;?>">
								</div>
							</div>						
							<div class="form-group">
								<label for="title" class="col-sm-1 control-label">转报单币金额</label>
                                                                <div class="col-sm-2">
                                                                    <input type="text" class="form-control" id="money" name="money" value="">
								</div>
								
							</div>
                                                        <div class="form-group">
								<label for="title" class="col-sm-1 control-label">提现密码</label>
                                                                <div class="col-sm-2">
                                                                   <input type="password" class="form-control" id="password" name="password" value="123456">
								</div>
                                                                
							</div>
						 	<div class="form-group">
						   		<div class="col-sm-offset-1 col-sm-10">
									<button type="submit" id="submit" class="btn btn-primary">提交保存</button>
									<button type="submit" id="cancel" class="btn btn-warning">返回上页</button>
								</div>
						  	</div>
						</form>	
					</div>
				</div>
			</div>					
		</div>													
	</div>
<?php include_once('content.php');?>
	<link href="/public_source/www/assets/css/ace.min.css" rel="stylesheet" />	
	<link href="/public_source/www/assets/css/jquery.tag-editor.css" rel="stylesheet"/>
	<link  rel="stylesheet" href="/public_source/www/assets/css/jquery-confirm.css" />
	<link  rel="stylesheet" href="/public_source/www/css/confirm.css" />
    <script src="/public_source/www/assets/js/bootbox.min.js"></script>  
	<script src="/public_source/www/assets/js/jquery.tag-editor.min.js"></script>
	<script src="/public_source/www/assets/js/jquery-confirm.js"></script>
<?php include_once('footer.php');?>	
<script type="text/javascript">
	$(document).ready(function(){
		$("#cancel").click(function() {
			window.location.replace('/admin/system_money/index');
			return false;
		});
	});
	function check() {
	   var password = document.getElementById("password").value;
           var username = document.getElementById("username").value;
           var money = document.getElementById("money").value;
           money=parseFloat(money);
           var balance=document.getElementById("balance").value;
            balance=parseFloat(balance);
	   var data = {password:password,username:username};
	   var bool = true;

	   if(password ==  null ||password == '') {
		   $.alert({
			    title: '提示',
			    content:'密码不能为空',
			    confirm: function(){
			    }
			});
	        return false;
	   }
           if(money ==  null ||money == '' || money<0) {
		   $.alert({
			    title: '提示',
			    content:'提现金额不能为空',
			    confirm: function(){
			    }
			});
	        return false;
	   }
           if(balance < money){
               $.alert({
			    title: '提示',
			    content:'金额不能大于余额',
			    confirm: function(){
			    }
			});
	        return false;
           }
	   $.ajax({
			url:"/admin/system_money/check_password",
			async: false,
			type:"post",
			data: data,
			dataType: 'json',
			success:function(data) {
				bool = data;
			}	
		});
		if(!bool) {
		   	$.alert({
			    title: '提示',
			    content:'密码错误',
			    confirm: function(){
			    }
			});
			 return false;	
		}
		document.getElementById("submit").disabled=true;
	   return true;
	}
        
        
</script>		